var Adv_skd=require("./Adv_skd")

var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2pvzChannel = require("pvzChannel");
var $2DataManager = require("DataManager");
var $2UIManager = require("UIManager");
var $2UserDataManager = require("UserDataManager");
var $2TaSdk = require("TaSdk");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_BossSelectUI = /* */function (_cc$Component6) {
  babel_inherits(h, _cc$Component6);
  var _super6 = babel_createSuper(h);
  function h() {
    var _this13;
    babel_classCallCheck(this, h);
    _this13 = _super6.apply(this, arguments);
    _this13.buttonList = null;
    _this13.gray = null;
    _this13.normal = null;
    return _this13;
  }
  babel_createClass(h, [{
    key: "onLoad",
    value: function onLoad() {
      $2UserDataManager.default.instance.bossLevel.length < 3 && $2TaSdk.default.instance.AdsExposure($2TaSdk.VideoIndex.bossUnlock);
      this.initPlatform();
      this.initPanel();
    }
  }, {
    key: "initPanel",
    value: function initPanel() {
      Adv_skd.default.instance.hideAllAdv();
      Adv_skd.default.instance.showInterstitialAd();
      Adv_skd.default.instance.showGridAdRight();
      Adv_skd.default.instance.showGridAdLeft();

      for (var _e2 = 0; _e2 < 3; _e2++) {
        if ($2UserDataManager.default.instance.bossLevel.includes(_e2 + 1)) {
          this.buttonList.children[_e2].getChildByName("Mask").active = false;
          this.buttonList.children[_e2].getChildByName("video").active = false;
          this.buttonList.children[_e2].getComponent(cc.Sprite).setMaterial(0, this.normal);
          this.buttonList.children[_e2].children[0].getComponent(cc.Sprite).setMaterial(0, this.normal);
        } else {
          this.buttonList.children[_e2].getChildByName("Mask").active = true;
          this.buttonList.children[_e2].getChildByName("video").active = true;
          this.buttonList.children[_e2].getComponent(cc.Sprite).setMaterial(0, this.gray);
          this.buttonList.children[_e2].children[0].getComponent(cc.Sprite).setMaterial(0, this.gray);
        }
      }
    }
  }, {
    key: "initPlatform",
    value: function initPlatform() {}
  }, {
    key: "onClickVideo",
    value: function onClickVideo(e, t) {
      var _this14 = this;
      var a = parseInt(t);
      $2pvzChannel.pvzChannel.instance().showVideo({
        sucCall() {
          $2UserDataManager.default.instance.setbossLevel(a);
          _this14.initPanel();
        },
        failCall() {},
        endCall() {}
      });
    }
  }, {
    key: "onClickStart",
    value: function onClickStart(e) {
      $2DataManager.default.instance.bossLevel = parseInt(e.currentTarget.name);
      $2DataManager.default.instance.level = 20;
      $2UIManager.default.instance.openUI("MainUI");
      $2UIManager.default.instance.closeUI("MenuUI");
      $2UIManager.default.instance.closeUI("BossSelectUI");
    }
  }, {
    key: "onClickClose",
    value: function onClickClose() {
      Adv_skd.default.instance.hideAllAdv();

      $2UIManager.default.instance.closeUI("BossSelectUI");
    }
  }, {
    key: "onDestroy",
    value: function onDestroy() {}
  }]);
  return h;
}(cc.Component);
cc__decorate([ccp_property(cc.Node)], def_BossSelectUI.prototype, "buttonList", undefined);
cc__decorate([ccp_property(cc.Material)], def_BossSelectUI.prototype, "gray", undefined);
cc__decorate([ccp_property(cc.Material)], def_BossSelectUI.prototype, "normal", undefined);
def_BossSelectUI = cc__decorate([ccp_ccclass], def_BossSelectUI);
exports.default = def_BossSelectUI;